//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CSprite10.h>
///	@path	~/src/graphics/dx10/
///	@date	2008/12/20
///	@desc	.

#pragma once

#include "xeres.h"

#include "graphics/ISprite.h"
#include "graphics/dx10/CDevice10.h"

#include <d3dx10.h>

namespace xeres {

	/*!
		\class	CSprite10
		\brief	DirectX 9 sprite implementation.
	*/
	class CSprite10 : public ISprite
	{
	public:

		/// \ctor
		CSprite10( ID3DX10Sprite * sprite );

		/// \dtor
		virtual ~CSprite10( void );

		DECL_IOBJECT_CLASS( CSprite10 , ISprite );

	public:

		/*!
			\brief		Called when device is lost or before reset.
		*/
		virtual bool OnLostDevice( void );

		/*!
			\brief		Called after device is reset.
		*/
		virtual bool OnResetDevice( RefWeak<IDevice> device );

		/*!
			\brief		Prepare to begin draw.
		*/
		virtual void Begin( RenderContext& rc );

		/*!
			\brief		Call to end draw.
		*/
		virtual void End( RenderContext& rc );

		/*!
			\brief		Draw text with font.
		*/
		virtual int DrawText( RefWeak<IFont> font , const WString& text ,
			int rect[4] , int style , PackColor4 color );

		/*! 
			\brief		Draw texture.
		*/
		virtual void DrawTexture( RefWeak<ITexture> tex , const Rect<int> * rect , float depth );

		// local methods

		/*!
			\brief		Get IDX3DSprite interface.
		*/
		ID3DX10Sprite * GetSprite( void ) { return m_pSprite; }

	private:

		// data

		// sprite
		ID3DX10Sprite *	m_pSprite;
		Pair<int>		m_backbufferSize;
	};

} // namespace xeres
